package com.nuoniu.sibanyun.controller.erp;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.dto.ErpAccountModuleDto;
import com.nuoniu.sibanyun.entity.vo.ErpAccountModuleVo;
import com.nuoniu.sibanyun.service.erp.IErpAccountModuleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 账套模块设置 前端控制器
 * </p>
 *
 * @author baiqiang
 * @since 2020-09-22
 */
@RestController
@RequestMapping("/erp/accountModule")
@Api(value = "账套模块设置",tags = "账套模块设置")
public class ErpAccountModuleController extends BaseController {

    @Autowired
    private IErpAccountModuleService erpAccountModuleService;

    @GetMapping("/list")
    @ApiOperation(value = "获取 某年 的 账套模块设置信息")
    public HttpResult<List<ErpAccountModuleVo>> list(Integer accountId) {
        return HttpResult.ok(erpAccountModuleService.listCurrentErpAccountModuleVo(accountId));
    }


    @PostMapping("/save")
    @ApiOperation(value = "保存 账套模块设置")
    public HttpResult save(@RequestBody List<ErpAccountModuleDto> erpAccountModuleDtos) {
        erpAccountModuleService.updateAccountModule(erpAccountModuleDtos);
        return HttpResult.ok();
    }
}
